package com.yanggu.redisson.config;

import org.redisson.api.RAtomicLong;
import org.redisson.api.RIdGenerator;
import org.redisson.api.RLongAdder;
import org.redisson.api.RedissonClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Redisson分布式计算器配置类
 */
@Configuration
public class RedissonCounterConfig {

    @Bean("test-id-generator")
    public RIdGenerator idGenerator(RedissonClient redissonClient) {
        return redissonClient.getIdGenerator("test-id-generator");
    }

    @Bean("test-atomic-long")
    public RAtomicLong atomicLong(RedissonClient redissonClient) {
        return redissonClient.getAtomicLong("test-atomic-long");
    }

    @Bean("test-long-adder")
    public RLongAdder longAdder(RedissonClient redissonClient) {
        return redissonClient.getLongAdder("test-long-adder");
    }

}



